<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			// 函数回调的案例
			function request(url, callback) {
				console.log('根据URL向服务器发送网络请求')
				console.log('需要划分比较长的时间拿到对应的结果')
				var list = ['javaScript', 'javaScript学校', 'javaScript高级']

				callback(list)
			}

			function handleResult(res) {
				console.log('在handleResult中拿到结果:', res)
			}

			request('url', handleResult)

			// 函数回到重构
			request('url', function (res) {
				console.log(res)
			})
		</script>
	</body>
</html>
